<?php
namespace PsiFramework\Applications\DefaultApp\Classes\Actions\Pages;

import("Classes.Actions.AbstractAction");

use \PsiFramework\Classes\Actions\AbstractAction;
use \PsiFramework\Classes\Util\Parameters\Action\ActionParameters;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'action de page
 *
 * @package Actions.Pages
 */
class PageAction extends AbstractAction
{

    protected /*array*/ $_parameters ;

    public function __construct(ActionParameters $actionParameters)
    {
        parent::__construct($actionParameters);
        $this->_parameters = array();
    }

    public function addParameter(/*string*/ $name, /*object*/ $value)
    {
        $this->_parameters[$name] = $value ;
    }

    /**
     * The main function of the method which is called every time
     * an action is created by the front controller.
     *
     */
    public function execute()
    {
        parent::execute();

        foreach ($this->_parameters as $key=>$value) {
            $this->_response->setAttribute($key, $value);
        }

        $this->findForward("success");
    }
}
